package com.yb.nowcoder;

import java.util.Scanner;

/**
 * 华为机试练习第二题
 */
public class Main2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextLine()) {
            String s = in.nextLine().toUpperCase();
            char target = in.nextLine().toUpperCase().toCharArray()[0];
            int count = 0;
            for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i) == target) {
                    count++;
                }
            }
            System.out.println(count);
        }
    }
}
